package com.lfk.justweengine.utils.tool;

import com.lfk.justweengine.utils.tools.NetUtils;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import ohos.app.Context;
import org.junit.Assert;
import org.junit.Test;

public class NetUtilsOhosTest {

    @Test
    public void testIsConnected() {
        Context context = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        Assert.assertTrue(NetUtils.isConnected(context));
    }

    @Test
    public void testIsWifi() {
        Context context = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        Assert.assertTrue(NetUtils.isWifi(context));
    }

    @Test
    public void testOpenSetting() {
        Ability context = AbilityDelegatorRegistry.getAbilityDelegator().getCurrentTopAbility();
        NetUtils.openSetting(context);
        Assert.assertTrue(true);
    }

    @Test
    public void testIsGpsEnabled() {
        Context context = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        Assert.assertTrue(NetUtils.isGpsEnabled(context));
    }
}